package com.suep.data_analysis.repository;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suep.data_analysis.model.Agent;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AgentRepository extends BaseMapper<Agent> {

    /**
     * 根据条件查询代理人列表
     */
    @Select("SELECT * FROM t_agent WHERE ${ew.SQLSegment}")
    @Results({
            @Result(property = "agentId", column = "agent_id"),
            @Result(property = "agentName", column = "agent_name"),
            @Result(property = "gender", column = "gender"),
            @Result(property = "rarity", column = "rarity"),
            @Result(property = "elementType", column = "element_type"),
            @Result(property = "profession", column = "profession"),
            @Result(property = "faction", column = "faction"),
            @Result(property = "description", column = "description"),
            @Result(property = "imageUrl", column = "image_url"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time")
    })
    List<Agent> selectAgent(@Param("ew") Wrapper<Agent> queryWrapper);

    /**
     * 查询所有代理人列表
     */
    @Select("SELECT * FROM t_agent")
    @Results({
            @Result(property = "agentId", column = "agent_id"),
            @Result(property = "agentName", column = "agent_name"),
            @Result(property = "gender", column = "gender"),
            @Result(property = "rarity", column = "rarity"),
            @Result(property = "elementType", column = "element_type"),
            @Result(property = "profession", column = "profession"),
            @Result(property = "faction", column = "faction"),
            @Result(property = "description", column = "description"),
            @Result(property = "imageUrl", column = "image_url"),
            @Result(property = "createTime", column = "create_time"),
            @Result(property = "updateTime", column = "update_time")
    })
    List<Agent> selectAllAgent();
}